<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

<f:view>
  <!--  -->
  <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></meta>
      <title>
       <h:outputText value="Creer un nouveau composant"/>
      </title>
     <link href="../css/solutech.css" rel="stylesheet" media="screen"></link>
     
    </head>
    <body><h:form enctype="multipart/form-data">
        <table width="100%" border="0">
          <tr>
            <td>
              <h1 align="center">
               <h:graphicImage url="/img/logo.jpg"
                                alt="Solutech Logo" style="height: 124px; width: 181px"/>
                <h:outputText value="Solutech-Shop Application"/>
              </h1>
            </td>
          </tr>          
          <tr>
          <td> 
        <f:subview id="adminbar">
          <jsp:include page="adminbar.jsp"/>
        </f:subview>
          </td>
         </tr>
          <tr>
            <td>
              <p>
                <h:outputText value="Creation d'un nouveau composant" styleClass="PageTitle"/></p>

  <h:panelGrid width="100%" columns="1" border="0">
					<h:messages globalOnly="true" style="color: Red; font-weight: bold; font-style: normal" ></h:messages>
					
               	<f:facet name="header">
               	<P ALIGN="CENTER">
						<h:outputText value="#{CreerComposant_Backing.message}"
								style="color:green; font-weight: bold;" rendered="#{CreerComposant_Backing.exist}" styleClass="LoginSuccess"/>
			   </P>
			    </f:facet>       
			  </h:panelGrid>             

              <h:panelGrid width="80%" columns="3" border="0">
 <h:outputLabel value="Libelle:" for="libelle" />                
                <h:inputText required="true" id="libelle"
                             binding="#{CreerComposant_Backing.libelle}"/>
                <h:message for="libelle" errorClass="ValidateError"/>
             
                
                <h:outputLabel value="Description:" for="description" />                
                <h:inputTextarea required="true" id="description"
                             binding="#{CreerComposant_Backing.description}"/>
                <h:message for="description" errorClass="ValidateError"/>        

              
				<h:outputLabel value="Categorie:" for="cat" />
					
				<h:selectOneMenu  binding="#{CreerComposant_Backing.categorieLibelle}" id="categorieLibelle">
                 <f:selectItems value="#{CreerComposant_Backing.categorieLibelleItems}" />
                </h:selectOneMenu>
                
                <f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;</f:verbatim>
                <h:outputLabel value="Quantite en Stock" for="cat" />
                <h:selectOneMenu  binding="#{CreerComposant_Backing.quantiteStock}" id="quantiteStock">
                 <f:selectItems value="#{CreerComposant_Backing.quantites}" />
                </h:selectOneMenu>
					
				 <f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;</f:verbatim>
                <h:outputLabel value="Prix Unitaire" for="prix" />
                 <h:inputText required="true" id="prix"
                             binding="#{CreerComposant_Backing.prix}"
                             validator="#{CreerComposant_Backing.validatePrix}"/>
                <h:message for="prix" errorClass="ValidateError"/>
                
                               
                
				<h:outputLabel value="Image:" for="image" />
                            
                              
                  <t:inputFileUpload required="true"   id="fileupload" value="#{CreerComposant_Backing.upFile}" size="20"/>
                
                 
                <h:message for="image" errorClass="ValidateError"/>


                <f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;
                
                <h:outputLink value="file/#{CreerComposant_Backing.filename}" rendered="#{CreerComposant_Backing.filename != null}">
                Download back
            </h:outputLink>
                
                </f:verbatim>
                <h:panelGroup>
                  <h:commandButton value="Creer"
                                   action="#{CreerComposant_Backing.creerComposant}"/>
                  <f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;</f:verbatim>
                  <h:commandButton value="Cancel" action="cancel"
                                   immediate="true"/>
                                   
                </h:panelGroup>
				<f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;</f:verbatim>
			
              </h:panelGrid>
            </td>
          </tr>
        </table>
      </h:form></body>
  </html>
</f:view>